#include <STC15F2K60S2.H>
#include "InitHC138.h"

code unsigned char Nixie_Table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,
0x88,0x83,0xc6,0xa1,0x86,0x8e,0xc7,0xc8,0x8c,0xff};//L n p

unsigned char NixieBuf[9]={19,19,19,19,19,19,19,19,19};

unsigned char point[9]={0,0,0,0,0,0,0,0,0};

void Nixie_SetBuf(unsigned char Location,Number)
{
	NixieBuf[Location]=Number;
}

void Nixie(unsigned char Location,Number,dot)
{
	P0=0xff;
	InitHC138(7);
	P0=0x01<<(Location-1);
	InitHC138(6);
	P0=Nixie_Table[Number];
  if(dot)
  P0&=0x7f;
	InitHC138(7);
}

void Nixie_Loop()
{
	static unsigned char i=1;
	Nixie(i,NixieBuf[i],point[i]);
	i++;
	if(i==9)i=0;
}



